// pages/yuyue/yuyue.js

const app = getApp()
const api = require('../../../api/index.js')
let baseURL = 'https://www.didigolf.top/';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    display: ''
  },
  fanhui: function() {
    wx.reLaunch({
      url: '../indexs/indexs'
    })
  },
  showview: function() {
    this.setData({
      display: "block"
    })
  },
  hideview: function() {
    this.setData({
      display: "none"
    })
  },
  phoneCall: function() {
    var subject_id = this.data.result.subject_id
    console.log(this.data.result.subject_id)
    var data = {
      subject_id: subject_id
    }
    api.reservation(data, (res) => {
      console.log(res)
      if (res.data.code == 200) {
        wx.navigateBack({
          delta:1,
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(data) {
    console.log(data)

    var that = this
    api.subscribe(data, (res) => {
      console.log(res)
      that.setData({
        result: res.data.result
      })
    })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})